Skip to content

Fix NaNs in scattering integral#8

Merged
ecoskey merged 5 commits intoecoskey:feat/general_scatteringfrom
mate-h:m/general_scattering_fix
Sep 5, 2025
Merged

Fix NaNs in scattering integral#8
ecoskey merged 5 commits intoecoskey:feat/general_scatteringfrom
mate-h:m/general_scattering_fix

Conversation

@mate-h
Copy link

@mate-h mate-h commented Sep 4, 2025

Objective

  • Fix NaNs in scattering integral
  • Fix when the sky turns dark in case of 1 mie scatterer or no scatterers

Solution

  • Add max(extinction, MIN_EXTINCTION) to the scattering integrand denominator to avoid division by zero.
  • The value vec3(1e-12) chosen is arbitrary and I found it has no visual impact on existing coefficients. Can be lowered by a few orders of magnitude safely though.

Testing

  • Current atmosphere example and my own branch with alterations to the atmosphere example

@ecoskey ecoskey merged commit b51148a into ecoskey:feat/general_scattering Sep 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants